/* CodeBlock 代码展示组件样式 */
.myui-code-block {
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: var(--border-radius-lg, 12px);
  overflow: hidden;
  margin-bottom: 24px;
  background-color: var(--bg-primary, #ffffff);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.myui-code-block__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.myui-code-block__title {
  margin: 0 0 8px 0;
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: var(--font-weight-semibold, 600);
  color: var(--text-primary, #333333);
}

.myui-code-block__description {
  margin: 0;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--text-secondary, #6b7280);
  line-height: var(--line-height-relaxed, 1.75);
}

.myui-code-block__demo {
  padding: 24px 20px;
  background-color: var(--bg-secondary, #f9fafb);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  overflow-x: auto;
  word-wrap: break-word;
}

.myui-code-block__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background-color: var(--bg-primary, #ffffff);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.myui-code-block__action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--text-secondary, #6b7280);
  background: transparent;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: var(--border-radius-sm, 4px);
  cursor: pointer;
  transition: all var(--transition-fast, 150ms ease-in-out);
}

.myui-code-block__action-btn:hover {
  color: var(--color-primary, #3b82f6);
  border-color: var(--color-primary, #3b82f6);
  background-color: var(--color-primary-light, #dbeafe);
}

.myui-code-block__code {
  background-color: var(--color-gray-900, #1f2937);
  overflow-x: auto;
}

.myui-code-block__pre {
  margin: 0;
  padding: 20px;
  font-family: var(--font-family-mono, 'SF Mono', Monaco, Inconsolata, 'Roboto Mono', monospace);
  font-size: var(--font-size-sm, 0.875rem);
  line-height: var(--line-height-relaxed, 1.75);
  color: #e5e7eb;
  background: transparent;
  overflow-x: auto;
}

.myui-code-block__code-content {
  color: inherit;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  white-space: pre;
  word-wrap: normal;
  overflow-wrap: normal;
}

/* 语法高亮样式 */
.language-tsx .token.keyword,
.language-jsx .token.keyword,
.language-ts .token.keyword,
.language-js .token.keyword {
  color: #c792ea;
}

.language-tsx .token.string,
.language-jsx .token.string,
.language-ts .token.string,
.language-js .token.string {
  color: #a5d6ff;
}

.language-tsx .token.function,
.language-jsx .token.function,
.language-ts .token.function,
.language-js .token.function {
  color: #82aaff;
}

.language-tsx .token.tag,
.language-jsx .token.tag {
  color: #f07178;
}

.language-tsx .token.attr-name,
.language-jsx .token.attr-name {
  color: #ffcb6b;
}

.language-tsx .token.punctuation,
.language-jsx .token.punctuation,
.language-ts .token.punctuation,
.language-js .token.punctuation {
  color: #89ddff;
}

.language-tsx .token.comment,
.language-jsx .token.comment,
.language-ts .token.comment,
.language-js .token.comment {
  color: #676e95;
  font-style: italic;
}

/* 滚动条样式 */
.myui-code-block__pre::-webkit-scrollbar {
  height: 8px;
}

.myui-code-block__pre::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.myui-code-block__pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.myui-code-block__pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .myui-code-block {
    margin: 0 -16px 24px -16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .myui-code-block__demo {
    padding: 16px;
    overflow-x: auto;
  }
  
  .myui-code-block__demo > * {
    max-width: 100%;
    overflow-x: auto;
  }
  
  .myui-code-block__actions {
    padding: 8px 16px;
    flex-wrap: wrap;
  }
  
  .myui-code-block__pre {
    padding: 16px;
    font-size: var(--font-size-xs, 0.75rem);
    overflow-x: auto;
  }
  
  .myui-code-block__header {
    padding: 12px 16px;
  }
  
  .myui-code-block__title {
    font-size: var(--font-size-base, 1rem);
  }
}
